package com.xiaoshuidi.cloud.module.iot.api.device;

import com.github.pagehelper.PageInfo;
import com.xiaoshuidi.cloud.module.iot.api.device.vo.*;
import com.xiaoshuidi.cloud.module.iot.common.ResultModel;
import com.xiaoshuidi.cloud.module.iot.enums.ApiConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author Feng
 * @date 2023/6/19
 */
@FeignClient(name = ApiConstants.SERVERNAME)
public interface DeviceApi {
    String PREFIX = ApiConstants.PREFIX + "/device";

    /**
     * 根据device_no 列表批量查询设备列表
     *
     * @param deviceListByNosReqVO
     * @return
     */
    @PostMapping(PREFIX + "/find-device-list-device-nos-page")
    ResultModel<PageInfo<PullDeviceApiVo>> findDeviceListByDeviceNosPage(@RequestBody DeviceListByNosApiReqVO deviceListByNosReqVO);

    @PostMapping(PREFIX + "/find-device-list")
    ResultModel<List<PullDeviceApiVo>> findDeviceList(@RequestBody DeviceListByNosApiReqVO deviceListByNosReqVO);

    /**
     * 删除密码
     *
     * @param addPasswordModel
     * @return
     */
    @PostMapping(PREFIX+"password/deletePassword")
    public ResultModel<AddPasswordModelVo> deletePassword(@RequestBody AddPasswordModelVo addPasswordModel);


    /**
     * 获取电表详情
     * @param ammeterInfoReqModel
     * @return
     */
    @PostMapping(PREFIX+"/manage/getAmmeterInfo")
    public ResultModel<AmmeterInfoRes> getAmmeterInfo(@RequestBody AmmeterInfoReq ammeterInfoReqModel);

    /**
     * 电表用电明细
     * @param ammeterReportReqVO
     * @return
     */
    @PostMapping(PREFIX+"/manage/getAmmeterReport")
    public ResultModel<AmmeterReportRes> getAmmeterReport(@RequestBody WaterMeterReportRequest ammeterReportReqVO);


    /**
     * 根据设备编号获取水表详情
     * @param waterMeterCommonRequestModel
     * @return
     */
    @PostMapping(PREFIX+"/manage/getWatermeterInfo")
    public ResultModel<WaterMeterCommonResponse> getWatermeterInfo(@RequestBody WaterMeterCommonRequest waterMeterCommonRequestModel);

    /**
     * 水表用水明细
     * @param waterMeterReportRequestModel
     * @return
     */
    @PostMapping(PREFIX+"/manage/getWatermeterReport")
    public ResultModel<WaterMeterReportResponse> getWatermeterReport(@RequestBody WaterMeterReportRequest waterMeterReportRequestModel);

    /**
     * 门锁密码列表
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"password/getPasswordList")
    public ResultModel<List<AddPassword>> getPasswordList(@RequestParam("deviceNo") String deviceNo,@RequestParam("mobile") String mobile);

    /**
     * 密码修改（在线）
     * @param addPasswordModel
     * @return
     */
    @PostMapping(PREFIX+"password/updatePassword")
    public ResultModel<AddPassword> updatePassword(@RequestBody AddPassword addPasswordModel);

    /**
     * 门锁详情
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"manage/getDoorlockInfo")
    public ResultModel<DoorLockInformation> getDoorlockInfo(@RequestParam("deviceNo") String deviceNo);

    /**
     * 根据device_no获取设备年度总度数
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"manage/getCurrentReading")
    public ResultModel<DevicePriceVo> getCurrentReading(@RequestParam("deviceNo") String deviceNo,@RequestParam("deviceType") String deviceType);

    /**
     * 刷新水表
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"manage/refreshWatermeterInfo")
    public ResultModel<WaterMeterCommonResponseModel> refreshWatermeterInfo(@RequestParam("deviceNo") String deviceNo,@RequestParam("roomId") Long roomId);


    /**
     * 刷新水表
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"manage/refreshWatermeterInfo1")
    public ResultModel<WaterMeterCommonResponseModel> refreshWatermeterInfo1(@RequestParam("deviceNo") String deviceNo,@RequestParam("roomId") Long roomId, @RequestParam("charging") boolean charging);

    /**
     * 刷新电表
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"manage/refreshAmmeterInfo")
    public ResultModel<AmmeterInfoResModel> refreshAmmeterInfo(@RequestParam("deviceNo") String deviceNo,@RequestParam("roomId") Long roomId);

    /**
     * 刷新电表
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"manage/refreshAmmeterInfo1")
    public ResultModel<AmmeterInfoResModel> refreshAmmeterInfo1(@RequestParam("deviceNo") String deviceNo,@RequestParam("roomId") Long roomId, @RequestParam("charging") boolean charging);

    /**
     * 根据device_no获取抄表记录
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"manage/getDeviceDasage")
    public ResultModel<DeviceDosageVo> getDeviceDasage(@RequestParam("deviceNo") String deviceNo);

    /**
     * 退租清算
     * @param deviceDosageVo
     * @return
     */
    @PostMapping(PREFIX+"manage/updateSage")
    public ResultModel<DeviceDosageVo> updateSage(@RequestBody DeviceDosageVo deviceDosageVo);

    /**
     * 解绑设备
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"manage/unbind")
    public ResultModel unbind(@RequestParam("deviceNo") String deviceNo);

    /**
     * 下发密码（在线）
     * @param addPasswordModel
     * @return
     */
    @PostMapping(PREFIX+"password/addPassword")
    public ResultModel<AddPassword> addPassword(@RequestBody AddPassword addPasswordModel);

    /**
     * 获取异常预警用水电设备
     * @return
     */
    @PostMapping(PREFIX+"manage/getDeviceWaring")
    public ResultModel getDeviceWaring(@RequestBody List<DeviceWaringVo> deviceWaringVo);

    /**
     * 解绑设备
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"manage/deletePassWordByMobile")
    public ResultModel deletePassWordByMobile(@RequestParam("deviceNo") String deviceNo,@RequestParam("mobile") String mobile);

    /**
     * 解冻密码
     *
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"password/unFrozenPassword")
    public ResultModel unFrozenPassword(@RequestParam("deviceNo") String deviceNo,@RequestParam("mobile")String mobile);


    /**
     * 水表供水
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"waterMeter/switchOn")
    public ResultModel setWaterMeterSwitchOn(@RequestParam("deviceNo") String deviceNo );

    /**
     * 水表断水
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"waterMeter/switchOff")
    public ResultModel setWaterMeterSwitchOff(@RequestParam("deviceNo") String deviceNo);


    /**
     * 电表供电
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"ammeter/switchOn")
    public ResultModel setAmmeterSwitchOn(@RequestParam("deviceNo") String deviceNo);


    /**
     * 电表断电
     * @param deviceNo
     * @return
     */
    @GetMapping(PREFIX+"ammeter/switchOff")
    public ResultModel setAmmeterSwitchOff(@RequestParam("deviceNo") String deviceNo);

    @GetMapping(PREFIX+"/queryDeviceState")
    ResultModel<List<PullDeviceApiVo>> queryDeviceState(@RequestParam("deviceType")String deviceType, @RequestParam("time")String time);

    @GetMapping(PREFIX+"/queryNotOpenDoor")
    ResultModel<List<PullDeviceApiVo>> queryNotOpenDoor(@RequestParam("time") String time);

    @GetMapping(PREFIX+"/queryOpenDoor")
    ResultModel<List<PullDeviceApiVo>> queryOpenDoor(@RequestParam("time") String time);

    @GetMapping(PREFIX+"/queryOpenNum")
    ResultModel<List<PullDeviceApiVo>> queryOpenNum(@RequestParam("time")String time);

}
